package com.example.controller;


import com.example.entity.Comment;
import com.example.service.CommentService;
import com.example.utils.ResponseResult;
import com.example.utils.SystemConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.web.bind.annotation.*;

import static com.example.utils.SystemConstants.COMMON_COMMENT;
import static com.example.utils.SystemConstants.LINK_COMMENT;

@RestController
@RequestMapping("comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("commentList")
    public ResponseResult commentList( int pageNum, int pageSize, int articleId){
        return commentService.commentList(COMMON_COMMENT,pageNum,pageSize,articleId);
    }

    @PostMapping("")
    public ResponseResult comment(@RequestBody Comment comment){

        return commentService.comment(comment);
    }

    @GetMapping("linkCommentList")
    public ResponseResult linkcommentList(int pageNum, int pageSize, int articleId){
        return commentService.commentList(SystemConstants.LINK_COMMENT,pageNum,pageSize,articleId);
    }
}
